[user]
    email = {{ git_email }}
    name = {{ git_name }}
[core]
    quotepath = false
    editor = vim
    excludesfile = ~/.gitignore
    attributesfile = ~/.gitattributes
[format]
    headers = ""
    subjectprefix = ""
[diff]
    tool = nvimdiff
    renameLimit = 0
[diff "jp"]
    textconv = nkf -w
    cachetextconv = true
[diff "msword"] # http://progit.org/book/zh/ch7-2.html
    textconv = antiword -w0
    cachetextconv = true
[diff "msexcel"]
    textconv = xlhtml -fw -asc -te -xp:0-10 -xc:0-100
    cachetextconv = true
[diff "ansible-vault"]
    textconv = ansible-vault view
    cachetextconv = true
[difftool "normal"] # http://goo.gl/c8Xok
    cmd = diff $LOCAL $REMOTE
[difftool "nvimdiff"] # https://github.com/neovim/neovim/issues/2377
    cmd = nvim -d $LOCAL $REMOTE
[push]
    default = current
[gui]
    fontdiff = -family \"Andale Mono\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0

[tig]
    line-graphics = no
    tab-size = 4
[tig "color"]
    default = default default
    date = green default
    author = default default
    cursor = white blue
    title-blur = black white
    title-focus = black white bold
[tig "bind"]
    generic = i view-close
    diff = , previous
    diff = . next
    stage = , previous
    stage = . next

[color]
    status = auto
    diff = auto
    branch = auto
    interactive = auto
[color "diff"]
    frag = magenta

[branch "master"]
    remote = origin
    merge = refs/heads/master

[merge]
    tool = persistent
[mergetool "persistent"]
    # ref Brian Phillips @http://stackoverflow.com/questions/585844/merging-with-git-mergetool
    cmd = "nvim -d \"$PWD/$MERGED\" \
        +\":split $PWD/$REMOTE\" +\":set buftype=nowrite\" \
        +\":vertical diffsplit $PWD/$LOCAL\" +\":set buftype=nowrite\" \
        +\":vertical diffsplit $PWD/$BASE\" +\":set buftype=nowrite\" \
        +\":wincmd j\" \
        +\":nmap <ESC>1 :diffget BASE<CR>:diffupdate<CR>\" \
        +\":nmap <ESC>2 :diffget LOCAL<CR>:diffupdate<CR>\" \
        +\":nmap <ESC>3 :diffget REMOTE<CR>:diffupdate<CR>\" "

[alias]
    ci  = commit
    ce  = commit --allow-empty
    cm  = commit --amend
    co  = checkout
    cd  = checkout -b
    cp  = cherry-pick --no-commit # 复制一个 commit 所做的修改
    cpp = revert --no-commit      # 撤销一个 commit 所做的修改
    coo = reset HEAD -- # 撤消已提交到 local repos 的修改

    br  = branch

    di  = diff --ignore-submodules=dirty --no-prefix -p --stat # show difference between working tree and the index
    dc  = diff --ignore-submodules=dirty --no-prefix -p --stat --cached # show difference between index and local repos, what would be committed with "git commit"
    da  = diff --ignore-submodules=dirty --no-prefix -p --stat HEAD # show difference between working tree and local repos, what would be committed with "git commit -a"
    df  = diff --no-prefix --stat=200,78 # show different files between working tree and the index
    dt  = difftool -y
    do  = difftool -y -t normal
    dp  = !sh -c 'git diff HEAD "$0" | git apply --whitespace=nowarn --index -' # fast apply the patch against "$0" commit or branch

    fp  = format-patch -s

    ll  = log --pretty=format:'%C(blue)%h%Creset %cn %m %s %C(green)%C(dim)%cr%Creset %C(bold)%d%Creset' --branches --graph --since='2 weeks ago'
    ls  = log --pretty=format:'%C(blue)%h%Creset %cn %m %s %C(green)%C(dim)%ci%Creset %C(bold)%d%Creset' --all --graph
    lf  = log --pretty=format:'%C(blue)%h%Creset %cn %m %s %C(green)%C(dim)%ci%Creset %C(bold)%d%Creset' --stat

    ms  = merge --squash
    mf  = merge --no-ff # generate a merge commit even if the merge resolved as a fast-forward
    mt  = mergetool
    ppa = !sh -c 'git fetch origin merge-requests/$1/head:ppa/$1 && git di HEAD ppa/$1' -     # conflict with git-extra(git-mr)

    # 核弹级选项: filter-branch
    # http://progit.org/book/zh/ch6-4.html
    nc = filter-branch -f --tree-filter

    st  = status -s --ignore-submodules=dirty

    sma = submodule add
    smi = submodule init
    smu = submodule update
    sms = submodule status
    smy = submodule sync

    zc  = stash save
    zl  = stash list
    zo  = stash pop
    zd  = stash drop

    dci = svn dcommit
    dco = svn clone -r HEAD
    dca = svn clone
    dup = svn rebase
    dll = svn log --oneline --limit=20
    dls = svn log

#[http]
#       proxy = http://127.0.0.1:3128

# vim: set foldmethod=marker:
[merge "ours"]
    drive = true
